<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <script>
        // "abcoefoxyozzopp"查找字符串中所有o出现的位置
        var numb = "abcoefoxyozzopp";
        var arr = [];
        // var index = numb.indexOf('o');
        for(i=0;i<=numb.length-1;i++){
            if(numb.charAt(3) == numb.charAt(i)){
                arr.push(i);
            }
        }
        console.log(arr); 




    </script>



</body>

</html>